<template>
	<view class="content">
		<view class="content_con">
			<!-- <swiper :indicator-dots="true" :autoplay="true" :interval="3000" :duration="1000" class="swiper_wrap">
				<swiper-item>
					<view class="swiper-item">
						<image src="../../static/index_banner.jpg" mode=""></image>
					</view>
				</swiper-item>
				<swiper-item>
					<view class="swiper-item">
						<image src="../../static/index_banner.jpg" mode=""></image>
					</view>
				</swiper-item>
			</swiper> -->
			<view class="swiper-item">
				<image src="../../static/index_banner.jpg" mode="widthFix"></image>
			</view>
			<view class="list">
				<view class="item" v-for="item in list" :key="item.id" @tap="second" :data-id="item.id" :data-name="item.name">
					<text class="item_name" :class="{'f-s-33':item.name.length>2}">{{item.name}}</text>
					<image :src="host + item.image" mode="widthFix"></image>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import network from "../../utils/network.js"
	import config from "../../config.js"
	export default {
		data() {
			return {
				title: 'Hello',
				host: config.host,
				list:[]
			}
		},
		onLoad() {
			this.getList()
		},
		methods: {
			second(e){
				const {id,name} = e.currentTarget.dataset
				uni.navigateTo({
					url:`../second/second?id=${id}&name=${name}`
				})
			},
			getList(){
				network.get('/index/api/getCategoryList',{},res=>{
					this.list = res.data
				})
			}
		}
	}
</script>

<style>
	.content {
		max-width: 750px;
		margin: 0 auto;
		min-height: calc(100vh - 75rpx);
		padding-bottom: 75rpx;
		background: #f2ede1;
	}
	.content_con{
		min-height: calc(100vh - 200rpx);
		padding-bottom: 125rpx;
		background: #f2ede1 url(../../static/bottom_bg.png) no-repeat center bottom;
		background-size: 264rpx 93rpx;
	}
	.swiper_wrap{
		/* height: 364rpx; */
	}
	.swiper-item{
		width: 100%;
	}
	.swiper-item image{
		width: 100%;
		height: auto;
	}
	.list{
		padding: 25rpx 10rpx;
		display: flex;
		flex-wrap: wrap;
	}
	.item{
		width: 223rpx;
		margin: 10rpx;
		position: relative;
	}
	.item_name{
		position: absolute;
		color: #FFF;
		z-index: 9;
		right: 32rpx;
		top: 18rpx;
		font-size: 40rpx;
		font-weight: bold;
	}
	.f-s-33{
		font-size: 33rpx;
	}
	.item>image{
		width: 100%;
		height: auto;
	}
	@media screen and (min-width: 750px) {
		.item {
			width: 223px;
		}
	}
</style>
